package main

import (
	"fmt"
	"net"
)

var question string = "hello，请问今天天气怎么样"

func main() {
	fmt.Println("tcp客户端启动")
	connect, err := net.Dial("tcp", "localhost:8888")
	if err != nil {
		fmt.Println("tcp客户端建立连接失败！", err)
		return
	}
	fmt.Println("连接成功", connect.RemoteAddr())
	n, err := connect.Write([]byte(question))
	if err != nil {
		fmt.Println("tcp客户端数据发出失败！", err)
		return
	}
	fmt.Printf("发出了%d 个字节，%d，%v", n, len(question), question)
}
